<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
   xmlns:ui="http://java.sun.com/jsf/facelets"
   xmlns:f="http://java.sun.com/jsf/core"
   xmlns:h="http://java.sun.com/jsf/html"
   template="/WEB-INF/templates/default.xhtml">
   <ui:define name="content">
      <h1>Welcome to Teiid running in JBoss AS 7!</h1>

      <p>You have successfully deployed the Java EE 6 web application
         on JBoss AS 7.</p>

      <h:form id="reg">
         <h2>Register</h2>
         <p>Demonstrates Hibernate using Teiid to access Federated Data Sources.</p>
         <p></p>
         <p><b>NOTE:</b> The 'Stock Symbol' to use to register a company, must match what's in the marketdata-price.txt file. </p>
         <p>      The file already contains 'RHT', that can be used to test Registering a company</p>
         <p>      If you want to use a different stock symbol, you will need to update the file</p>
          <table>
            <tr>
               <th style="text-align: right;"><h:outputLabel
                     for="id" value="Product Id:" /></th>
               <td><h:inputText id="id" value="#{newProductInfo.id}" /><h:outputText value=" please enter unique Product Id!"/>
                  <h:message for="id" errorClass="invalid" /></td>
            </tr>
            <tr>
               <th style="text-align: right;"><h:outputLabel
                     for="companyName" value="Company Name:" /></th>
               <td><h:inputText id="companyName" value="#{newProductInfo.companyName}" />
                  <h:message for="companyName" errorClass="invalid" /></td>
            </tr>
            <tr>
               <th style="text-align: right;"><h:outputLabel
                     for="symbol" value="Stock Symbol:" /></th>
               <td><h:inputText id="symbol"
                     value="#{newProductInfo.symbol}" /> <h:message
                     for="symbol" errorClass="invalid" /></td>
            </tr>
 
         </table>
         <p>
            <h:commandButton id="register"
               action="#{productRegistration.register}" value="Register" />
            <h:outputText value=" Registered!"
               rendered="#{facesContext.postback and empty facesContext.messageList}"
               style="color: green;" />
         </p>
      </h:form>
      <h2>Products</h2>
      <h:panelGroup rendered="#{empty productInfos}">
         <em>No registered products.</em>
      </h:panelGroup>
      <h:dataTable var="_member" value="#{productInfos}"
         rendered="#{not empty productInfos}">
         <h:column>
            <f:facet name="header">Id</f:facet>
                #{_member.id}
            </h:column>
         <h:column>
            <f:facet name="header">Company Name</f:facet>
                #{_member.companyName}
            </h:column>
         <h:column>
            <f:facet name="header">Stock Symbol  </f:facet>
                #{_member.symbol}
            </h:column>
         <h:column>
            <f:facet name="header">Price</f:facet>
                #{_member.price}
            </h:column>
      </h:dataTable>
   </ui:define>
</ui:composition>
